\(\int \frac {1+x^2}{1+x^2+x^4} \, dx\) [73]

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 16, antiderivative size = 38 \[ \int \frac {1+x^2}{1+x^2+x^4} \, dx=-\frac {\arctan \left (\frac {1-2 x}{\sqrt {3}}\right )}{\sqrt {3}}+\frac {\arctan \left (\frac {1+2 x}{\sqrt {3}}\right )}{\sqrt {3}} \]

[Out]

-1/3*arctan(1/3*(1-2*x)*3^(1/2))*3^(1/2)+1/3*arctan(1/3*(1+2*x)*3^(1/2))*3^(1/2)

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 38, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.188, Rules used = {1175, 632, 210} \[ \int \frac {1+x^2}{1+x^2+x^4} \, dx=\frac {\arctan \left (\frac {2 x+1}{\sqrt {3}}\right )}{\sqrt {3}}-\frac {\arctan \left (\frac {1-2 x}{\sqrt {3}}\right )}{\sqrt {3}} \]

[In]

Int[(1 + x^2)/(1 + x^2 + x^4),x]

[Out]

-(ArcTan[(1 - 2*x)/Sqrt[3]]/Sqrt[3]) + ArcTan[(1 + 2*x)/Sqrt[3]]/Sqrt[3]

Rule 210

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[-b, 2])^(-1))*ArcTan[Rt[-b, 2]*(x/Rt[-a, 2])
], x] /; FreeQ[{a, b}, x] && PosQ[a/b] && (LtQ[a, 0] || LtQ[b, 0])

Rule 632

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 1175

Int[((d_) + (e_.)*(x_)^2)/((a_) + (b_.)*(x_)^2 + (c_.)*(x_)^4), x_Symbol] :> With[{q = Rt[2*(d/e) - b/c, 2]},
Dist[e/(2*c), Int[1/Simp[d/e + q*x + x^2, x], x], x] + Dist[e/(2*c), Int[1/Simp[d/e - q*x + x^2, x], x], x]] /
; FreeQ[{a, b, c, d, e}, x] && NeQ[b^2 - 4*a*c, 0] && EqQ[c*d^2 - a*e^2, 0] && (GtQ[2*(d/e) - b/c, 0] || ( !Lt
Q[2*(d/e) - b/c, 0] && EqQ[d - e*Rt[a/c, 2], 0]))

Rubi steps \begin{align*} \text {integral}& = \frac {1}{2} \int \frac {1}{1-x+x^2} \, dx+\frac {1}{2} \int \frac {1}{1+x+x^2} \, dx \\ & = -\text {Subst}\left (\int \frac {1}{-3-x^2} \, dx,x,-1+2 x\right )-\text {Subst}\left (\int \frac {1}{-3-x^2} \, dx,x,1+2 x\right ) \\ & = \frac {\tan ^{-1}\left (\frac {-1+2 x}{\sqrt {3}}\right )}{\sqrt {3}}+\frac {\tan ^{-1}\left (\frac {1+2 x}{\sqrt {3}}\right )}{\sqrt {3}} \\ \end{align*}

Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 0.13 (sec) , antiderivative size = 99, normalized size of antiderivative = 2.61 \[ \int \frac {1+x^2}{1+x^2+x^4} \, dx=\frac {\left (-i+\sqrt {3}\right ) \arctan \left (\frac {x}{\sqrt {\frac {1}{2} \left (1-i \sqrt {3}\right )}}\right )}{\sqrt {6 \left (1-i \sqrt {3}\right )}}+\frac {\left (i+\sqrt {3}\right ) \arctan \left (\frac {x}{\sqrt {\frac {1}{2} \left (1+i \sqrt {3}\right )}}\right )}{\sqrt {6 \left (1+i \sqrt {3}\right )}} \]

[In]

Integrate[(1 + x^2)/(1 + x^2 + x^4),x]

[Out]

((-I + Sqrt[3])*ArcTan[x/Sqrt[(1 - I*Sqrt[3])/2]])/Sqrt[6*(1 - I*Sqrt[3])] + ((I + Sqrt[3])*ArcTan[x/Sqrt[(1 +
 I*Sqrt[3])/2]])/Sqrt[6*(1 + I*Sqrt[3])]

Maple [A] (verified)

Time = 0.05 (sec) , antiderivative size = 34, normalized size of antiderivative = 0.89

method result size
default \(\frac {\sqrt {3}\, \arctan \left (\frac {\left (2 x -1\right ) \sqrt {3}}{3}\right )}{3}+\frac {\arctan \left (\frac {\left (1+2 x \right ) \sqrt {3}}{3}\right ) \sqrt {3}}{3}\) \(34\)
risch \(\frac {\sqrt {3}\, \arctan \left (\frac {x \sqrt {3}}{3}\right )}{3}+\frac {\sqrt {3}\, \arctan \left (\frac {x^{3} \sqrt {3}}{3}+\frac {2 x \sqrt {3}}{3}\right )}{3}\) \(35\)

[In]

int((x^2+1)/(x^4+x^2+1),x,method=_RETURNVERBOSE)

[Out]

1/3*3^(1/2)*arctan(1/3*(2*x-1)*3^(1/2))+1/3*arctan(1/3*(1+2*x)*3^(1/2))*3^(1/2)

Fricas [A] (verification not implemented)

none

Time = 0.24 (sec) , antiderivative size = 31, normalized size of antiderivative = 0.82 \[ \int \frac {1+x^2}{1+x^2+x^4} \, dx=\frac {1}{3} \, \sqrt {3} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (x^{3} + 2 \, x\right )}\right ) + \frac {1}{3} \, \sqrt {3} \arctan \left (\frac {1}{3} \, \sqrt {3} x\right ) \]

[In]

integrate((x^2+1)/(x^4+x^2+1),x, algorithm="fricas")

[Out]

1/3*sqrt(3)*arctan(1/3*sqrt(3)*(x^3 + 2*x)) + 1/3*sqrt(3)*arctan(1/3*sqrt(3)*x)

Sympy [A] (verification not implemented)

Time = 0.05 (sec) , antiderivative size = 41, normalized size of antiderivative = 1.08 \[ \int \frac {1+x^2}{1+x^2+x^4} \, dx=\frac {\sqrt {3} \cdot \left (2 \operatorname {atan}{\left (\frac {\sqrt {3} x}{3} \right )} + 2 \operatorname {atan}{\left (\frac {\sqrt {3} x^{3}}{3} + \frac {2 \sqrt {3} x}{3} \right )}\right )}{6} \]

[In]

integrate((x**2+1)/(x**4+x**2+1),x)

[Out]

sqrt(3)*(2*atan(sqrt(3)*x/3) + 2*atan(sqrt(3)*x**3/3 + 2*sqrt(3)*x/3))/6

Maxima [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 33, normalized size of antiderivative = 0.87 \[ \int \frac {1+x^2}{1+x^2+x^4} \, dx=\frac {1}{3} \, \sqrt {3} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (2 \, x + 1\right )}\right ) + \frac {1}{3} \, \sqrt {3} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (2 \, x - 1\right )}\right ) \]

[In]

integrate((x^2+1)/(x^4+x^2+1),x, algorithm="maxima")

[Out]

1/3*sqrt(3)*arctan(1/3*sqrt(3)*(2*x + 1)) + 1/3*sqrt(3)*arctan(1/3*sqrt(3)*(2*x - 1))

Giac [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 26, normalized size of antiderivative = 0.68 \[ \int \frac {1+x^2}{1+x^2+x^4} \, dx=\frac {1}{6} \, \sqrt {3} {\left (\pi \mathrm {sgn}\left (x\right ) + 2 \, \arctan \left (\frac {\sqrt {3} {\left (x^{2} - 1\right )}}{3 \, x}\right )\right )} \]

[In]

integrate((x^2+1)/(x^4+x^2+1),x, algorithm="giac")

[Out]

1/6*sqrt(3)*(pi*sgn(x) + 2*arctan(1/3*sqrt(3)*(x^2 - 1)/x))

Mupad [B] (verification not implemented)

Time = 0.09 (sec) , antiderivative size = 29, normalized size of antiderivative = 0.76 \[ \int \frac {1+x^2}{1+x^2+x^4} \, dx=\frac {\sqrt {3}\,\left (\mathrm {atan}\left (\frac {\sqrt {3}\,x^3}{3}+\frac {2\,\sqrt {3}\,x}{3}\right )+\mathrm {atan}\left (\frac {\sqrt {3}\,x}{3}\right )\right )}{3} \]

[In]

int((x^2 + 1)/(x^2 + x^4 + 1),x)

[Out]

(3^(1/2)*(atan((2*3^(1/2)*x)/3 + (3^(1/2)*x^3)/3) + atan((3^(1/2)*x)/3)))/3